package com.google.gdata.data.douban;

import com.google.gdata.data.BaseEntry;
import com.google.gdata.data.ExtensionDescription;
import com.google.gdata.data.ExtensionProfile;

import java.util.List;

/**
 * User entry specific for a douban user. Contains setters and getters for all
 * fields specific to user data.
 */
@ExtensionDescription.Default(
		nsAlias = "", 
		nsUri = "http://www.w3.org/2005/Atom", 
		localName = "entry")
public class MailEntry extends BaseEntry<MailEntry>{
	public MailEntry(){
		super();
		//_extProfile = new ExtensionProfile();
	}
	
	public MailEntry(MailEntry source){
		super(source);
		//_extProfile = new ExtensionProfile();
	}
	
	@Override
	public void declareExtensions(ExtensionProfile extProfile)
	{
		super.declareExtensions(extProfile);
        extProfile.declareAdditionalNamespace(Namespaces.gNs);

       // extProfile.declare(MailEntry.class,Location.class);
		extProfile.declare(MailEntry.class, Attribute.class);
		//extProfile.declareAdditionalNamespace(Namespaces.doubanNs);
		extProfile.declareArbitraryXmlExtension(MailEntry.class);
	}
	//protected ExtensionProfile _extProfile;
	public Attribute getAttribute() {
        System.out.println(this.attributes);
		return getExtension(Attribute.class);
	}

    protected List<Attribute> attributes;

     public List<Attribute> getAttributes() {

         return getRepeatingExtension(Attribute.class);
     }

    public void setAttributes(List<Attribute> atts) {
        if (atts == null) {
            removeExtension(Attribute.class);
        } else {
            for (Attribute att : atts)
                addRepeatingExtension(att);
        }
    }

}